package com.zzl.bonds.ticket.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zzl.bonds.ticket.dto.StatisticsDataDto;
import com.zzl.bonds.ticket.dto.TicketTransferInfo;
import com.zzl.bonds.ticket.dto.TicketransferAddDto;
import com.zzl.bonds.ticket.dto.TicketransferUpdateDto;
import com.zzl.bonds.ticket.dto.feign.ApprovalSubmitDto;
import com.zzl.bonds.ticket.dto.feign.NoticeApprovalResult;
import com.zzl.bonds.ticket.entity.TicketProcessEntity;
import com.zzl.bonds.ticket.entity.TicketransferEntity;
import com.zzl.general.common.exception.SysException;
import com.zzl.general.common.serurity.entity.User;
import com.zzl.general.common.utils.PageUtils;

import java.util.Date;
import java.util.Map;

/**
 * 转让申请单
 *
 * @author sunpp
 * @date 2022-02-16 11:14:07
 */
@SuppressWarnings("javadoc")
public interface TicketTransferService extends IService<TicketransferEntity> {

    /**
     * 分页查询
     *
     * @param params 查询参数
     * @return 分页数据
     */
    PageUtils queryPage(Map<String, Object> params, User user, String type);

    /**
     * 分页查询转让待审核凭证
     * @param params params
     * @param user user
     * @return PageUtils
     */
    PageUtils queryPageApprove(Map<String, Object> params, User user);

    /**
     * 根据票据状态和 兑付时间 计算剩余时间
     * @param cashTime cashTime
     * @param ticketStatus ticketStatus
     * @return 时间
     */
    String calculateSurplusDays(Date cashTime, Integer ticketStatus);

    /**
     * 新增
     *
     * @param ticketransferAddDto 新增实体
     * @param user                当前登录用户
     * @throws SysException 业务异常
     */
    String saveTicketransfer(TicketransferAddDto ticketransferAddDto, User user) throws SysException;


    /**
     * 详情
     *
     * @param id id)
     * @return TicketTransferInfo
     */
    TicketTransferInfo info(String id);

    /**
     * 复核转让审批单
     *
     * @param approvalSubmitDto approvalSubmitDto
     * @param user user
     * @throws SysException 异常
     */
    void recheckTransferOrder(ApprovalSubmitDto approvalSubmitDto, User user) throws SysException;

    /**
     *处理转让涉及的票状态
     * @param entity TicketransferEntity
     * @param passOrReject passOrReject
     * @param childStatus childStatus
     * @param bo bo
     * @throws SysException  SysException
     */
    void changeStatus(TicketransferEntity entity, String passOrReject, Integer childStatus, boolean bo) throws SysException;

    /**
     * 转单签收
     *
     * @param ticketransfer ticketransfer
     * @param user user
     * @throws SysException 异常
     */
    void signTransferOrder(ApprovalSubmitDto ticketransfer, User user) throws SysException;

    /**
     *转让页面的三个统计数量
     * @param user user
     * @return StatisticsDataDto
     */
    StatisticsDataDto getTransferData(User user);

    /**
     *分页查询转让签收凭证列表
     * @param params params
     * @param user user
     * @return PageUtils
     */
    PageUtils listSignApprove(Map<String, Object> params, User user);

    /**
     * 撤销转单
     * @param id id
     * @param user user
     * @throws SysException 异常
     */
    void cancelTransferTicket(String id, User user) throws SysException;

    /**
     * 转让签收页面的三个统计数量
     * @param user user
     * @return StatisticsDataDto
     */
    StatisticsDataDto getTransferSignData(User user);

    /**
     * 兑付
     * @param days days
     */
    void executeWaitingPayment(Integer days);

    /**
     * 分页查询转让审核列表凭证列表
     * @param params params
     * @param user user
     * @return PageUtils
     */
    PageUtils listPlatformApprove(Map<String, Object> params, User user);

    /**
     * 转让平台审批
     * @param ticketransfer ticketransfer
     * @param user user
     * @throws SysException 异常
     */
    void approveTransferOrder(TicketransferUpdateDto ticketransfer, User user)throws SysException;


    /**
     * 转让申请 审批流程回调
     * @param noticeApprovalResult noticeApprovalResult
     * @param ticketProcessEntity ticketProcessEntity
     * @param user user
     * @throws SysException 异常
     */
    void transferReviewCallback(NoticeApprovalResult noticeApprovalResult, TicketProcessEntity ticketProcessEntity, User user) throws SysException;

    /**
     * 转让签收审批回调
     *
     * @param noticeApprovalResult noticeApprovalResult
     * @param ticketProcessEntity ticketProcessEntity
     * @param user user
     */
    void transferSignInApprovalCallback(NoticeApprovalResult noticeApprovalResult, TicketProcessEntity ticketProcessEntity, User user) throws SysException;

    /**
     * 转让复核详情
     * @param id id
     * @return TicketTransferInfo
     * @throws SysException 异常
     */
    TicketTransferInfo recheckInfo(String id) throws SysException;

    TicketTransferInfo signInfo(String id) throws SysException;
}

